css check if mobile

48

@media only screen and (max-device-width: 480px){
 /* in mobile css commands */ 
}
//CSS
.visibledevice {display:none;}
.visibledesktop {display:display;}

@media (max-width : 320px) {
    .visibledevice {display:block;}
    .visibledesktop {display:none;}
}

//in the page
<div class="visibledesktop">this displays for desktop and tablet</div>

<div class="visibledevice">this displays for mobile</div>

Comments

Submit
0 Comments